import axios from '@/libs/api.request'

export const getMenuList = () => {
  return axios.request({
    url: '/sys/menu/nav',
    method: 'get'
  })
}

export const getAllMenuList = () => {
  return axios.request({
    url: '/sys/menu/all',
    method: 'get'
  })
}

export const saveOrUpdateMenu = (obj) => {
  let url = obj.id === undefined ? 'add' : 'update'
  return axios.request({
    url: '/sys/menu/' + url,
    method: 'post',
    data: obj
  })
}

export const infoMenu = (id) => {
  return axios.request({
    url: '/sys/menu/info?id=' + id,
    method: 'get'
  })
}

export const deleteMenu = (id) => {
  return axios.request({
    url: '/sys/menu/delete',
    method: 'post',
    data: id
  })
}
